package com.wq.myspring.beantest;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @PackageName: com.example.mytest
 * @ClassName MainTest
 * @Description: TODO
 * @Author Wenqiang
 * @Date 2021/07/16 12:10
 * @Version V1.0
 */
public class MyTest {
	public static void main(String[] args) {
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spring-bean.xml");
		Person person = ctx.getBean("person", Person.class);
		person.setName("张三");
		System.out.println("person ==>" + person);
	}
}

class Person{
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "[" + hashCode() + "] Person{" +
				"name='" + name + '\'' +
				'}';
	}
}